package com.snbc.Io;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @Classname Flush
 * @Description TODO
 * @Date 2019/9/27 22:19
 * @Created by Acer
 */
public class Flush {
    /*
    有的时候，需要立即把数据写入到硬盘，而不是等缓存满了才写出去。 这时候就需要用到flush
    * */
    public static void main(String[] args) {
        File file = new File("F:\\123444mmm\\28833.txt");
        FileWriter fw = null;
        PrintWriter pw =null;
        try {
            fw = new FileWriter(file);
            pw=new PrintWriter(fw);
            pw.println("teemo revive after 1 minutes1");
            pw.flush();
            pw.println("teemo revive after 1 minutes2");
            pw.flush();
            pw.println("teemo revive after 1 minutes3");
            pw.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }




        }
}
